package cn.kgc.itrip.biz.service.impl;

import cn.kgc.itrip.beans.pojo.ItripLabelDic;
import cn.kgc.itrip.beans.vo.ItripLabelDicVO;
import cn.kgc.itrip.biz.service.LabelDicService;
import cn.kgc.itrip.dao.itriplabeldic.ItripLabelDicMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LabelDicServiceImpl implements LabelDicService {

    @Resource
    private ItripLabelDicMapper itripLabelDicMapper;

    @Override
    public List<ItripLabelDic> queryHotelFeature() throws Exception {
        Map<String, Object> params = new HashMap<>();
        params.put("parentId", "16");
        return itripLabelDicMapper.getItripLabelDicListByMap(params);
    }

    @Override
    public List<ItripLabelDic> queryHotelFeatureByHotelId(Long hotelId) throws Exception {
        return itripLabelDicMapper.getItripLabelDicListByHotelId(hotelId);
    }

    @Override
    public List<ItripLabelDicVO> queryHotelRoomBed() throws Exception {
        List<ItripLabelDicVO> vos = new ArrayList<>();
        Map<String, Object> params = new HashMap<>();
        // 床型
        params.put("parentId", 1);
        List<ItripLabelDic> labelDics = itripLabelDicMapper.getItripLabelDicListByMap(params);
        for (ItripLabelDic labelDic : labelDics) {
            ItripLabelDicVO vo = new ItripLabelDicVO();
            BeanUtils.copyProperties(labelDic, vo);
            vos.add(vo);
        }
        return vos;
    }
}
